<!--//查询所有考试-->
<template>
  <div class="all">
    <el-card>
      <el-descriptions title="就业信息登记" class="margin-top" :column="1" border>
        <el-descriptions-item >
          <template slot="label">
            <i class="el-icon-tickets"></i>
            就业状态
          </template>
          <el-select v-model="form.Status" >
            <el-option label="已就业" value="1"></el-option>
            <el-option label="未就业" value="0"></el-option>
          </el-select>
        </el-descriptions-item>

        <el-descriptions-item>
          <template slot="label">
            <i class="el-icon-edit"></i>
            就业单位
          </template>
          <el-input v-model="form.Employer"></el-input>
        </el-descriptions-item>

        <el-descriptions-item >
          <template slot="label">
            <i class="el-icon-aim"></i>
            职位
          </template>
          <el-input  v-model="form.Position"></el-input>
        </el-descriptions-item>

        <el-descriptions-item >
          <template slot="label">待业原因</template>
          <el-input
            type="textarea"
            :rows="3"
            v-model="form.UnemployReason"></el-input>
        </el-descriptions-item>
      </el-descriptions>
      <el-button type="primary" class="change-btn" @click="submit">提交</el-button>
    </el-card>
  </div>
</template>

<script>
export default {
  data() {
    return {
      form: {
        Status:null,
        Employer:'',
        Position:'',
        UnemployReason:''
      }, //就业信息,
      userInfo:{},//用户信息
    }
  },
  methods: {
    submit(){
      this.$axios({
        url:'/api/track/insert',
        method:'patch',
        data: {
          StudentID: this.userInfo.Name,
          Name:this.userInfo.realname,
          PhoneNumber:this.userInfo.ContactInfo,
          Status:this.form.Status,
          Employer:this.form.Employer,
          Position:this.form.Position,
          UnemployReason:this.form.UnemployReason
        },
        headers:{
          "Authorization":this.$cookies.get("token")
        }
      }).then(res =>{
        if(res.data.code === 0){
          this.$message.success("提交成功")
          this.form = null
        }else {
          this.$message.error(res.data.message)
        }
      })
    },
    getUserInfo(){
      this.$axios({
        url:'/api/user/userInfo',
        method:'get',
        headers:{
          'Authorization':this.$cookies.get('token')
        }
      }).then(res =>{
        this.userInfo = res.data.data
      })
    }
  },
  created() {
    this.getUserInfo()
  }
};
</script>
<style lang="less" scoped>
.all {
  padding: 0px 40px;
  .page {
    margin-top: 20px;
    display: flex;
    justify-content: center;
    align-items: center;
  }
  .edit {
    margin-left: 20px;
  }
  .el-table tr {
    background-color: #dd5862 !important;
  }
}
.exam {
  padding: 0px 40px;
  .page {
    margin-top: 20px;
    display: flex;
    justify-content: center;
    align-items: center;
  }
  .edit{
    margin-left: 20px;
  }
}
.change-btn{
  margin-left: 45%;
  margin-top: 20px;
  width: 100px
}
</style>
